local sk__xiyu = fk.CreateSkill {

  name = "sk__xiyu",

  tags = {  },

}



sk__xiyu:addEffect(fk.TurnStart, {
  name = "sk__xiyu",
  anim_type = "support",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(sk__xiyu.name) and
      table.find(player.room.alive_players, function (p)
        return not p:isAllNude()
      end)
  end,
  on_cost = function (self, event, target, player, data)
    local room = player.room
    local targets = table.filter(room.alive_players, function (p)
      return not p:isAllNude()
    end)
    local to = room:askForChoosePlayers(player, table.map(targets, Util.IdMapper), 1, 1,
      "#sk__xiyu-choose", sk__xiyu.name, true)
    if #to > 0 then
      event:setCostData(self, to[1])
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local to = room:getPlayerById(event:getCostData(self))
    local card = room:askForCardChosen(player, to, "hej", sk__xiyu.name, "#sk__xiyu-discard::"..to.id)
    room:throwCard(card, sk__xiyu.name, to, player)
    if not to.dead then
      to:gainAnExtraPhase(Player.Play)
    end
  end,
})

return sk__xiyu